var a = getApp();

Page({
    data: {
        isMember: "",
        page: 1
    },
    onLoad: function(a) {
        this.search();
    },
    goSearch: function() {
        this.search();
    },
    goDetail: function(a) {
        var e = a.currentTarget.dataset.item;
        console.log(e), wx.navigateTo({
            url: "/packageE/energy/powerDetail/powerDetail?info=" + JSON.stringify(e)
        });
    },
    keywork: function(a) {
        console.log(a);
        var e = a.detail.value;
        this.setData({
            isMember: e
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (this.data.current_page >= this.data.last_page) wx.showToast({
            title: "没有更多了",
            icon: "none",
            duration: 1e3
        }); else {
            var a = this.data.page + 1;
            this.setData({
                page: a
            }), this.searchMore();
        }
    },
    onShareAppMessage: function() {},
    search: function() {
        var e = a.getNetAddresss("plugin.energy-cabin.frontend.user-terminal.search-member"), t = this;
        a._getNetWork({
            url: e,
            data: {
                member: t.data.isMember,
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result && (console.log(e), t.setData({
                    list: e.data.data,
                    current_page: e.data.data.current_page,
                    last_page: e.data.data.last_page
                }));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    searchMore: function() {
        wx.showLoading({
            title: "加载中"
        });
        var e = a.getNetAddresss("plugin.energy-cabin.frontend.user-terminal.search-member"), t = this;
        a._getNetWork({
            url: e,
            data: {
                member: t.data.isMember,
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result && (console.log(e), t.setData({
                    list: t.data.list.concat(e.data.data),
                    current_page: e.data.data.current_page,
                    last_page: e.data.data.last_page
                }), wx.hideLoading({
                    complete: function(a) {}
                }));
            },
            fail: function(a) {
                console.log(a), wx.hideLoading({
                    complete: function(a) {}
                });
            }
        });
    }
});